package com.example.springtransdemo.Service;

import com.example.springtransdemo.Mapper.UserInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {
    @Autowired
    private UserInfoMapper userInfoMapper;
//    @Transactional(propagation = Propagation.REQUIRED)
//    public Integer insertLog(String username, String password) {
//        int a=10/0;
//      return userInfoMapper.insertUser(username,password);
//    }
//@Transactional(propagation = Propagation.REQUIRES_NEW)
//public void insertLog(String username, String password) {
//     userInfoMapper.insertUser(username,password);
//
//}
@Transactional(propagation = Propagation.NESTED)
public void insertLog(String username, String password) {
    userInfoMapper.insertUser(username,password);
}
}
